
import { loadEnv } from 'vite';

const lifecycle = process.env.npm_lifecycle_event;
const envVariable = loadEnv(process.argv[process.argv.length - 1], './env');
export default defineNuxtConfig({
    app: {
        baseURL: '/',
        head: {
            title: "AISEO",
            link: [
                {
                    rel: "icon",
                    type: "images/x-icon",
                    href: "/edged_64x64.ico",
                },
            ],
            //   script: [
            //     {src: "~/assets/iconfont/iconfont.js", type: "text/javascript" },

            //   ],
            meta: [
                { charset: "utf-8" },
                { name: "viewport", content: "width=device-width, initial-scale=1" },
                { hid: "keywords", name: "keywords", content: "AIseo，seo、软文代写，网站建设，网站设计，整合营销，新闻发稿，软文发布，软文发稿，软文推广平台" },
                { hid: "description", name: "description", content: "AIseo，为企业提供软文代写、发布，官网seo，整合营销等企业营销服务，专业seo团队，设计团队，内容宣传团队，数据分析团队。AISEO拥有丰富的站点资源，为企业提供从网站建设，到网站设计，到官网权重问题解决等一站式解决方案。" },
            ],
        },
        //文件转换的特效 pageTransition: { name: 'slide-right', mode: 'out-in' },
    },
    vite: {
        build: {
            assetsInlineLimit: 0, // 这个大小可以自己调节
        },
        plugins: [
        ],
        css: {
            preprocessorOptions: {
                scss: {
                    additionalData: '@use "~/assets/scss/index.scss" as *;',
                },
            },
        },
        server: {
            proxy: {
                '/api': {
                    target: 'https://push.aiseoword.com',   //测试环境代理接口
                    // target:'https://image.aiseoword.com', //正式环境
                    changeOrigin: true,//生成环境https需要加这个
                    secure: false,
                    rewrite: (path) => path.replace(/^\/api/, '')
                },
                '/chat': {
                    target: 'https://api.aiseoword.com',   //测试环境代理接口
                    // target:'https://api.aiseoword.com', //正式环境
                    changeOrigin: true,
                    secure: false,//生成环境https需要加这个
                    rewrite: (path) => path.replace(/^\/chat/, '')
                },
            }
        },
    },
    components: true,
    css: ["~/assets/css/style.css","~/assets/fonts/fonts.css"],

    transpile: ["element-plus"],
    build: {
        transpile: lifecycle === "build" ? ["element-plus"] : [],
    },
    runtimeConfig: { // 运行时常量
        public: { // 客户端-服务的都能访问
            fileUploadUrl: envVariable.VITE_FILEUPLOAD_BASE_URL,
            baseUrl: envVariable.VITE_CHAT_BASE_URL,
            websoketChatUrl: envVariable.VITE_WEBSOKET_CHAT_URL,
            envUrl: envVariable.VITE_NODE_ENV
        }
    },
    devServer: {
	    host: '0.0.0.0',
	    port: 3000
	  },
    //   nitro: {
    //     prerender: false,
    //   },
    optimizeDeps: {
        include: ['html-docx-js']
      },
    modules: ['@pinia/nuxt',"@pinia-plugin-persistedstate/nuxt", '@element-plus/nuxt','@vant/nuxt'],
})